Skip to content

fix(jsonb): dump timestamps with time zones - #7977

Open
dongyikuan919 wants to merge 1 commit into
alibaba:mainfrom
dongyikuan919:fix/jsonb-dump-zoned-timestamp
Open

dongyikuan919 wants to merge 1 commit into
alibaba:mainfrom
dongyikuan919:fix/jsonb-dump-zoned-timestamp

Conversation

@dongyikuan919

Copy link
Copy Markdown

What this PR does / why we need it?

Fixes #7976. A ZonedDateTime serialized by JSONB.toBytes can be parsed from JSONB, but JSONB.toJSONString threw on BC_TIMESTAMP_WITH_TIMEZONE. This also happens in raw mode.

Summary of your change

Reuse the existing zoned timestamp reader for that token, write the resulting JSON time string with the existing writer, and advance the dump cursor to the next value. Regression tests cover normal and raw scalar output, plus an array with an integer following the timestamp.

The two new tests failed before the change. All 69 targeted Maven tests passed on JDK 17 with zero Checkstyle violations. A JDK 8 smoke check also passed for scalar, raw, and array output.

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.
中文说明

修复 #7976。JSONB.toJSONString 遇到带时区的时间戳时,复用现有读取器和 JSON 时间写入逻辑,再同步读取位置。新增用例验证普通与 raw 模式,以及数组中紧随时间戳的元素。JDK 17 下 69 项 Maven 定向测试全部通过,Checkstyle 无违规。JDK 8 下三个场景的冒烟验证也通过。

OpenAI Codex assisted with reproduction, implementation, and testing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] JSONB.toJSONString 无法转换带时区的时间戳

1 participant